function res = getTermPremia(model,x_cu)

%% Computing Mean and standard deviation for term premia
% The fitted value for term premium
T            = size(x_cu,2);
TP           = zeros(length(model.TPss),T);
RealTP       = zeros(length(model.RealTPss),T);
for t=1:T
    if model.pruningOn == 1
        if model.appOrder == 1
            
        elseif model.appOrder == 2
            TP(:,t) = 0.5*model.TPss;
            RealTP(:,t) = 0.5*model.RealTPss;
        elseif model.appOrder == 3
            xf_cu       = x_cu(1:model.nx,t);
            TP(:,t)     = 0.5*model.TPss + 3/6*model.TPssx*xf_cu;
            RealTP(:,t) = 0.5*model.RealTPss + 3/6*model.RealTPssx*xf_cu;
        end
    else
        xt_cu     = x_cu(1:model.nx,t);
        TP(:,t)   = 0.5*model.TPss + 3/6*model.TPssx*xt_cu;
        RealTP(:,t) = 0.5*model.RealTPss + 3/6*model.RealTPssx*xt_cu;
    end
end

%% The output - multiplying by 40000 (to get tp in annual basis points)
res.MeanTP     = mean(TP*40000,2);
res.StdTP      = std(TP*40000,0,2);
res.RealMeanTP = mean(RealTP*40000,2);
res.RealStdTP  = std(RealTP*40000,0,2);
if T < 1000
    res.TP     = TP*40000;
    res.RealTP = RealTP*40000;
end


end